{include file="public/header"}
<body>
<style>
    .layui-form-label{
        width: 200px;
    }
    .layui-input{
        width:70%;
    }
</style>
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color:red">*</span> 每次红包时间间隔</label>
        <div class="layui-input-block">
            <input type="text" value="{$list['0']['value']}" name="time" placeholder="每次红包时间间隔"  class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color:red">*</span> 每人每次活动红包个数</label>
        <div class="layui-input-block">
            <input type="text" name="count" required  value="{$list['1']['value']}" placeholder="每人每次活动红包个数" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否开启地区限制</label>
        <div class="layui-input-block">
            <input type="checkbox" name="area" lay-skin="switch" lay-text="ON|OFF" value="1"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color:red">*</span> 每次活动红包人数上限</label>
        <div class="layui-input-block">
            <input type="text" name="team_num" required value="{$list['3']['value']}" placeholder="每次活动红包人数上限" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="admin-form">立即提交</button>
        </div>
    </div>
</form>


{include file="public/footer"}

<script>
    layui.use('form', function(){
        var form = layui.form();
        form.on('submit(admin-form)', function(data){

            $.ajax({
                type: "POST",
                url: '{:url("activitysetting_act")}',
                data: data.field,
                success: function(msg){

                    if( msg.errorCode == 0 ){
                        layer.msg(msg.msg,{time:1800},function(){
                            location.reload();
                        });
                    }else{
                        parent.layer.msg(msg.msg, {
                            icon: 5,
                            shade: [0.6, '#393D49'],
                            time:1500
                        });
                    }
                }
            });
            return false;
        });

    });
</script>

</body>
</html>